﻿using PSE.Deployment.SetupBase.Configuration;

namespace PSE.Deployment.ConfigurationManager.Controls
{
	/// <summary>
	/// UserControl que instancia uma caixa de texto que permite multiplas linhas de inserção
	/// </summary>
	public class MultipleTextBox : BaseSimpleTextBox
	{
		private MultipleTextBox()
		{
			this.AcceptsReturn = true;
			this.AcceptsTab = true;
			this.Height = 75;
			this.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
			this.VerticalAlignment = System.Windows.VerticalAlignment.Center;
		}

		public MultipleTextBox(XmlTag tag) : this()
		{
			this.DataContext = tag;
			ConfigurationBinding bd = new ConfigurationBinding();
			this.SetBinding(MultipleTextBox.TextProperty, bd);
			this.IsRequired = tag.IsRequired;
		}

		public MultipleTextBox(XmlAttribute attribute) : this()
		{
			this.DataContext = attribute;
			ConfigurationBinding bd = new ConfigurationBinding();
			this.SetBinding(MultipleTextBox.TextProperty, bd);
			this.IsRequired = attribute.IsRequired;
		}

		public MultipleTextBox(RegistryValue reg) : this()
		{
			this.DataContext = reg;
			ConfigurationBinding bd = new ConfigurationBinding();
			this.SetBinding(MultipleTextBox.TextProperty, bd);
			this.IsRequired = reg.IsRequired;
		}
	}
}